<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<html:html locale="true">
<head>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
<title></title>
<link href="console.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
.even {
	background:	#eee;
}

.odd {

}
</style>
<link href="../console.css" rel="stylesheet" type="text/css">
</head>

<body>
<jsp:include page="/title.jsp" flush="true"/>

	<p class="lnkhead2"><bean:message key="menu.orgManagers"/>&gt;<bean:write name="domain"  filter="true"/></p>

<table width="100%" border="0" cellpadding="3" cellspacing="1">
	<tr class="txtnormal2" >		
		<td align="left">
			<table width="100%" border="0" cellpadding="0"  cellspacing="0">
			<form action="org.do?" method="post" name="updategroupform">		
		<tr  class="txtnormal2">			

			<td><bean:message key="org.groupId"/>:
				
				<b><bean:write name="group" property='id'/></b>
				
			</td>
				<td><bean:message key="org.groupName"/>
				
				<input type="text" name="groupName" size="16" value="<bean:write name="group" property='name'/>"/>
				
			</td>
			<td><bean:message key="org.parentGroup"/>
				<html:select name="group" property="parentId" >
   <html:option value=""><bean:message key="org.noParentGroup"/></html:option>
    <html:options collection ="grouplist" property="id" labelProperty="name"></html:options>
</html:select>
				</td>
			<td><bean:message key="org.manager"/>
				
				<input type="text" name="Owner"   size="12" value="<bean:write name="group" property='owner'/>"/>
				</td>
			
			<td>
			</tr>
	<tr  class="txtnormal2">
		<td><bean:message key="org.attr1"/>
			<input type="text" name="attr1"  size="16" maxlength="36" value="<bean:write name="group" property='attr1'/>"/></td>
			<td><bean:message key="org.attr2"/>
			<input type="text" name="attr2"  size="16" maxlength="36" value="<bean:write name="group" property='attr2'/>"/></td>
			<td><bean:message key="org.attr3"/>
			<input type="text" name="attr3"  size="16" maxlength="36" value="<bean:write name="group" property='attr3'/>"/></td>
		<td>
			<logic:equal name="readonly" value="false">
			<input type="button" name="Submit3" value='<bean:message key="button.update"/>' onclick="javascript:updateGroup()">
			</logic:equal>
			</td>
			<input type="hidden" name="domain" value="<bean:write name='domain'/>"/>	
			<input type="hidden" name="act" value="updateGroup"/>
			
			<input type="hidden" name="groupTypeId" value="<bean:write name="group" property='groupTypeId'/>"/>
			<input type="hidden" name="id" value="<bean:write name="group" property='id'/>"/>
	</tr>
</table>
		</td>
</tr>
	<tr class="txtnormal2" >		
		<form action="org.do?" method="post" name="deleteform">	
			<table width="100%" border="0" cellpadding="1" class="sort-table" id="table-1" cellspacing="0">
	
	<thead>
			<tr >
			<td align="center" width="5%">
					
&nbsp;
					
				</td>
						<td align="center" width="10%">
					
					<bean:message key="org.userId"/>
					
				</td>
				<td align="center" width="10%">
					
					<bean:message key="org.userName"/>
					
				</td>
				
			
				<td align="center" width="15%">
					
					<bean:message key="org.email"/>
					
				</td>
				
				<td align="center" width="10%">
					
					<bean:message key="org.tel"/>
					
				</td>
				
				<td align="center" width="10%">
					
					<bean:message key="org.mobile"/>
					
				</td>
				<td align="center" width="6%">
					<bean:message key="org.attr1"/>
				</td>
			<td align="center" width="6%">
					<bean:message key="org.attr2"/>
				</td>
				<td align="center" width="6%">
					<bean:message key="org.attr3"/>
				</td>
				<td align="center" width="6%">
					<bean:message key="org.attr4"/>
				</td>
				<td align="center" width="6%">
					<bean:message key="org.attr5"/>
				</td>
			</tr>
			
			</thead>
				<tbody>
			<% int i=0; String color;String check="";%>			
			<logic:iterate id="user" name="list">
				
				<% i++; if(i%2==1) color="odd"; else color="even"; if(i==1) check="checked"; else check="";%>
				
				<tr  class="<%=color%>">
				<td align="center">
		<input type="radio" <%=check%> name="id"  value="<bean:write name='user' property='id'/>" />	
						</td>
				<td align="left">
						<bean:write name="user" property="id" filter="true"/>
					</td>
					<td align="left">
						<bean:write name="user" property="name" filter="true"/>					
					</td>
					
					
					
					<td align="center">
						
						<bean:write name="user" property="email" filter="true"/>
						
					</td>
					<td align="center">
						
					<bean:write  name="user" property="tel"  filter="true"/>
						
					</td>
					<td align="center">
						
						<bean:write name="user" property="mobile" filter="true"/>
						
					</td>
					<td align="center">
						<bean:write name="user" property="attr1"/>
					</td>
						<td align="center">
						<bean:write name="user" property="attr2"/>
					</td>
						<td align="center">
						<bean:write name="user" property="attr3"/>
					</td>
						<td align="center">
						<bean:write name="user" property="attr4"/>
					</td>
						<td align="center">
						<bean:write name="user" property="attr5"/>
					</td>
				</tr>
				
			</logic:iterate>
			
</tbody>
			</table>
			</form>
	<logic:equal name="readonly" value="false">
		
		<table width="100%" border="0" cellpadding="0"  cellspacing="0">
			<form action="org.do?" method="post" name="addmenberform">		
		<tr  class="txtnormal2">			
<td width="50%" align=left>
	<input type="button" name="Submit3" value='<bean:message key="org.remove"/>' onclick="javascript:removeUser()">
	<input type="button" name="Submit4" value='<bean:message key="button.moveup"/>' onclick="javascript:up()">
	<input type="button" name="Submit5" value='<bean:message key="button.movedown"/>' onclick="javascript:down()">
				</td>
			
			<td align="right"><bean:message key="org.userId"/>:
				<input type="text" name="userId"   size="12"/>
				</td>
	
			<td align="left">
			<input type="button" name="Submit3" value='<bean:message key="org.addMenber"/>' onclick="javascript:addMenber()">
		</td>
				<input type="hidden" name="id" value="<bean:write name="group" property='id'/>"/>
		<input type="hidden" name="groupTypeId" value="<bean:write name="group" property='groupTypeId'/>"/>
			<input type="hidden" name="act" value="addMenber"/>
				<input type="hidden" name="domain" value="<bean:write name='domain'/>"/>
			<input type="hidden" name="groupTypeId" value="<bean:write name="group" property='groupTypeId'/>"/>
			<input type="hidden" name="groupId" value="<bean:write name="group" property='id'/>"/>
	</tr>
</table>
</logic:equal>	
<script language="JavaScript">		
var st = new SortableTable(document.getElementById("table-1"),
	["None", "String","String",  "String", "String"]);
	function addMenber()
	{
	var frm = document.forms["addmenberform"];
	if(frm.elements["userId"].value=="")
		{ alert("<bean:message key='org.needUserId'/>");
		return;
		}
	
	frm.submit();
	};

	function removeUser()
	{
	var frm1 = document.forms["deleteform"];
	var id=(selectedRadiobox(frm1,"id"));
	if(id==null) return;
	if( !confirm("<bean:message key='button.confirmDelete'/>ID:"+id)) return;
	var frm = document.forms["addmenberform"];
	frm.elements["act"].value="removeMenber";
	frm.elements["userId"].value=id;
	frm.submit();
	};
	function up()
	{
	var frm1 = document.forms["deleteform"];
	var id=(selectedRadiobox(frm1,"id"));
	if(id==null) return;
	var frm = document.forms["addmenberform"];
	frm.elements["act"].value="upUser";
	frm.elements["userId"].value=id;
	frm.submit();
	};
	function down()
	{
	var frm1 = document.forms["deleteform"];
	var id=(selectedRadiobox(frm1,"id"));
	if(id==null) return;
	var frm = document.forms["addmenberform"];
	frm.elements["act"].value="downUser";
	frm.elements["userId"].value=id;
	frm.submit();
	};
	function updateGroup()
	{
	var frm = document.forms["updategroupform"];
	if(frm.elements["parentId"].value==frm.elements["id"].value)
	{ alert("<bean:message key='org.needGroupName'/>");
		return;
	}
	if(frm.elements["groupName"].value=="")
	{ alert("<bean:message key='org.needGroupName'/>");
		return;
	}
	frm.submit();
	};

	function deleteGroup()
	{
	var frm = document.forms["updategroupform"];
	if( !confirm("<bean:message key='button.confirmDelete'/>")) return;
	frm.elements["act"].value="deleteGroup";
	frm.submit();
	};

	function modify(groupid)
	{
	var frm = document.forms["form"];
	frm.elements["act"].value="updateGroup";
	frm.elements["id"].value=groupid;
	frm.submit();
	};
	
	function shift_visibility(image1){
 if(image1.style.visibility == "visible")
  image1.style.visibility = "hidden";
  else  image1.style.visibility = "visible";
}

</script>
</tr>
</table>
<%@ include file="/table_bottom.jsp" %>
<logic:notEmpty name="returnMsg">
	<script>
	alert('<bean:write name="returnMsg"/>');
	</script>
	</logic:notEmpty>
</body>
</html:html>
